﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Web.Mvc.DataAnnotations
{
    public class CharLengthAttribute : System.ComponentModel.DataAnnotations.StringLengthAttribute
    {
        public CharLengthAttribute(int length)
            : base(length)
        {
        }

        public override bool IsValid(object value)
        {
            if (value != null)
            {
                return value.ToString().Length <= this.MaximumLength;
            }
            return true;
        }
    }
}
